#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>

using namespace std;

int main()
{
	int n, k;
	cin >> n >> k;
	vector<int> arr(n);

	for (int i = 0; i < n; i++)
	{
		cin >> arr[i];
	}
	for (int i = 0; i < k; i++)
	{
		for (int j = 0 ; j < n-i-1; j++)
		{
			if (arr[j] > arr[j+1])
				swap(arr[j], arr[j+1]);
		}
	}

	cout << arr[0];
	auto it = arr.begin() + 1;
	while (it != arr.end())
	{
		cout << " " << *it;
		*it++;
	}

	return 0;
}